package processcontrol;

import java.util.Scanner;

/**
 * @author shkstart
 * @date 2022/4/8 - 21:04
 */
public class SwitchTest01 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入2019的月份：");
        int month = scan.nextInt();
        System.out.println("请输入2019的日期：");
        int day = scan.nextInt();

//        定义一个变量来保存天数
//        方式1：冗余
/*
        int sumDays = 0;
        if (month == 1 ) {
            sumDays = day;
        }else if (month == 2 ) {
            sumDays = 31 + day;
        }
//      ......
        else { // month == 12
            //sumDays = ...+day;
        }
*/
        int sumDays = 0;
        switch(month) {
            case 12 :
                sumDays += 30;
            case 11 :
                sumDays += 31;
            case 10 :
                sumDays += 30;
            case 9 :
                sumDays += 31;
            case 8 :
                sumDays += 31;
            case 7 :
                sumDays += 30;
            case 6 :
                sumDays += 31;
            case 5 :
                sumDays += 30;
            case 4 :
                sumDays += 31;
            case 3 :
                sumDays += 28;
            case 2 :
                sumDays += 31;
            case 1 :
                sumDays += day;
        }
        System.out.println(+sumDays);

    }
}
